-- phpMyAdmin SQL Dump
-- version 2.10.3
-- http://www.phpmyadmin.net
-- 
-- Host: localhost
-- Generation Time: Aug 21, 2014 at 11:33 PM
-- Server version: 5.0.51
-- PHP Version: 5.2.6

SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";

-- 
-- Database: `smk_db`
-- 

-- --------------------------------------------------------

-- 
-- Table structure for table `com_menu`
-- 

CREATE TABLE `com_menu` (
  `nav_id` int(11) unsigned NOT NULL auto_increment,
  `portal_id` int(11) unsigned default NULL,
  `nav_title` varchar(50) default NULL,
  `nav_desc` varchar(100) default NULL,
  `nav_url` varchar(100) default NULL,
  `nav_no` int(11) unsigned default NULL,
  PRIMARY KEY  (`nav_id`),
  KEY `FK_com_menu_p` (`portal_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- 
-- Dumping data for table `com_menu`
-- 


-- --------------------------------------------------------

-- 
-- Table structure for table `com_portal`
-- 

CREATE TABLE `com_portal` (
  `portal_id` int(11) unsigned NOT NULL auto_increment,
  `portal_nm` varchar(50) default NULL,
  `site_title` varchar(100) default NULL,
  `site_desc` varchar(100) default NULL,
  PRIMARY KEY  (`portal_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- 
-- Dumping data for table `com_portal`
-- 


-- --------------------------------------------------------

-- 
-- Table structure for table `com_role`
-- 

CREATE TABLE `com_role` (
  `role_id` int(11) unsigned NOT NULL auto_increment,
  `portal_id` int(11) unsigned default NULL,
  `role_nm` varchar(50) default NULL,
  `role_desc` varchar(100) default NULL,
  `default_page` varchar(50) default NULL,
  PRIMARY KEY  (`role_id`),
  KEY `portal_id` (`portal_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- 
-- Dumping data for table `com_role`
-- 


-- --------------------------------------------------------

-- 
-- Table structure for table `com_role_menu`
-- 

CREATE TABLE `com_role_menu` (
  `role_id` int(11) unsigned NOT NULL,
  `nav_id` int(11) unsigned NOT NULL,
  PRIMARY KEY  (`nav_id`,`role_id`),
  KEY `FK_com_role_menu_r` (`role_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

-- 
-- Dumping data for table `com_role_menu`
-- 


-- --------------------------------------------------------

-- 
-- Table structure for table `com_user`
-- 

CREATE TABLE `com_user` (
  `user_id` int(11) NOT NULL auto_increment,
  `username` varchar(10) NOT NULL,
  `password` varchar(32) NOT NULL,
  PRIMARY KEY  (`user_id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=3 ;

-- 
-- Dumping data for table `com_user`
-- 

INSERT INTO `com_user` VALUES (1, 'admin', '21232f297a57a5a743894a0e4a801fc3');
INSERT INTO `com_user` VALUES (2, 'lulu', '654e4dc5b90b7478671fe6448cab3f32');

-- --------------------------------------------------------

-- 
-- Table structure for table `tb_agama`
-- 

CREATE TABLE `tb_agama` (
  `id_agama` int(1) NOT NULL auto_increment,
  `agama` varchar(10) NOT NULL,
  PRIMARY KEY  (`id_agama`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=8 ;

-- 
-- Dumping data for table `tb_agama`
-- 

INSERT INTO `tb_agama` VALUES (2, 'Islam');
INSERT INTO `tb_agama` VALUES (3, 'Kristen');
INSERT INTO `tb_agama` VALUES (4, 'Budha');
INSERT INTO `tb_agama` VALUES (5, 'Hindu');
INSERT INTO `tb_agama` VALUES (6, 'Katolik');
INSERT INTO `tb_agama` VALUES (7, 'Konghucu ');

-- --------------------------------------------------------

-- 
-- Table structure for table `tb_cabut_berkas`
-- 

CREATE TABLE `tb_cabut_berkas` (
  `no_pendaftaran` varchar(5) NOT NULL,
  `nama_pengguna` varchar(50) NOT NULL,
  PRIMARY KEY  (`no_pendaftaran`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- 
-- Dumping data for table `tb_cabut_berkas`
-- 


-- --------------------------------------------------------

-- 
-- Table structure for table `tb_nilai`
-- 

CREATE TABLE `tb_nilai` (
  `id_nilai` int(5) NOT NULL auto_increment,
  `no_pendaftaran` int(11) default NULL,
  `matematika` float(3,2) default NULL,
  `inggris` float(3,2) default NULL,
  `indonesia` float(3,2) default NULL,
  `ipa` float(3,2) default NULL,
  `jumlah` float(4,2) default NULL,
  `rata2` float(3,2) default NULL,
  `status` varchar(15) NOT NULL,
  PRIMARY KEY  (`id_nilai`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=55 ;

-- 
-- Dumping data for table `tb_nilai`
-- 


-- --------------------------------------------------------

-- 
-- Table structure for table `tb_pendaftar`
-- 

CREATE TABLE `tb_pendaftar` (
  `no_pendaftaran` varchar(5) character set utf8 NOT NULL,
  `tgl_daftar` date NOT NULL,
  `kd_proli` varchar(3) character set utf8 NOT NULL,
  `pendaftar_name` varchar(50) character set utf8 NOT NULL,
  `pendaftar_gender` enum('male','female') character set utf8 NOT NULL,
  `tmpt_lahir` varchar(50) character set utf8 NOT NULL,
  `tgl_lahir` date NOT NULL,
  `id_agama` int(1) NOT NULL,
  `nama_ortu` varchar(50) character set utf8 NOT NULL,
  `pekerjaan_ortu` varchar(25) character set utf8 NOT NULL,
  `alamat` varchar(100) character set utf8 NOT NULL,
  `no_hp` varchar(12) character set utf8 NOT NULL,
  `asal_sekolah` varchar(30) character set utf8 NOT NULL,
  `matematika` float(3,2) NOT NULL,
  `indonesia` float(3,2) NOT NULL,
  `inggris` float(3,2) NOT NULL,
  `ipa` float(3,2) NOT NULL,
  `rata2` float(3,2) NOT NULL,
  `jumlah` float(4,2) NOT NULL,
  `ket_ijazah` varchar(20) character set utf8 NOT NULL,
  `status_daftar` varchar(9) character set utf8 NOT NULL,
  `user_id` int(11) NOT NULL,
  PRIMARY KEY  (`no_pendaftaran`),
  KEY `id_agama` (`id_agama`),
  KEY `kd_proli` (`kd_proli`),
  KEY `user_id` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

-- 
-- Dumping data for table `tb_pendaftar`
-- 


-- --------------------------------------------------------

-- 
-- Table structure for table `tb_pesan`
-- 

CREATE TABLE `tb_pesan` (
  `id_pesan` int(3) NOT NULL auto_increment,
  `nama` varchar(25) NOT NULL,
  `email` varchar(25) NOT NULL,
  `pesan` text NOT NULL,
  PRIMARY KEY  (`id_pesan`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=22 ;

-- 
-- Dumping data for table `tb_pesan`
-- 


-- --------------------------------------------------------

-- 
-- Table structure for table `tb_petugas`
-- 

CREATE TABLE `tb_petugas` (
  `petugas_id` int(11) NOT NULL auto_increment,
  `user_id` int(11) default NULL,
  `nip` int(20) NOT NULL,
  `petugas_name` varchar(50) character set utf8 NOT NULL,
  `jabatan` varchar(20) character set utf8 NOT NULL,
  PRIMARY KEY  (`petugas_id`,`nip`),
  KEY `user_id` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- 
-- Dumping data for table `tb_petugas`
-- 


-- --------------------------------------------------------

-- 
-- Table structure for table `tb_proli`
-- 

CREATE TABLE `tb_proli` (
  `kd_proli` varchar(3) NOT NULL,
  `nama_proli` varchar(25) NOT NULL,
  PRIMARY KEY  (`kd_proli`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- 
-- Dumping data for table `tb_proli`
-- 

INSERT INTO `tb_proli` VALUES ('P01', 'Akuntansi');
INSERT INTO `tb_proli` VALUES ('P02', 'Administrasi Perkantoran');
INSERT INTO `tb_proli` VALUES ('P03', 'Tata Niaga');
INSERT INTO `tb_proli` VALUES ('P04', 'Rekayasa Perangkat Lunak');
INSERT INTO `tb_proli` VALUES ('P05', 'Multimedia');

-- 
-- Constraints for dumped tables
-- 

-- 
-- Constraints for table `com_menu`
-- 
ALTER TABLE `com_menu`
  ADD CONSTRAINT `FK_com_menu_p` FOREIGN KEY (`portal_id`) REFERENCES `com_portal` (`portal_id`);

-- 
-- Constraints for table `com_role`
-- 
ALTER TABLE `com_role`
  ADD CONSTRAINT `com_role_ibfk_1` FOREIGN KEY (`portal_id`) REFERENCES `com_portal` (`portal_id`);

-- 
-- Constraints for table `com_role_menu`
-- 
ALTER TABLE `com_role_menu`
  ADD CONSTRAINT `FK_com_role_menu_m` FOREIGN KEY (`nav_id`) REFERENCES `com_menu` (`nav_id`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `FK_com_role_menu_r` FOREIGN KEY (`role_id`) REFERENCES `com_role` (`role_id`) ON DELETE CASCADE ON UPDATE CASCADE;

-- 
-- Constraints for table `tb_cabut_berkas`
-- 
ALTER TABLE `tb_cabut_berkas`
  ADD CONSTRAINT `tb_cabut_berkas_ibfk_1` FOREIGN KEY (`no_pendaftaran`) REFERENCES `tb_pendaftar` (`no_pendaftaran`) ON DELETE CASCADE ON UPDATE CASCADE;

-- 
-- Constraints for table `tb_pendaftar`
-- 
ALTER TABLE `tb_pendaftar`
  ADD CONSTRAINT `tb_pendaftar_ibfk_1` FOREIGN KEY (`id_agama`) REFERENCES `tb_agama` (`id_agama`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `tb_pendaftar_ibfk_2` FOREIGN KEY (`kd_proli`) REFERENCES `tb_proli` (`kd_proli`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `tb_pendaftar_ibfk_3` FOREIGN KEY (`user_id`) REFERENCES `com_user` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE;

-- 
-- Constraints for table `tb_petugas`
-- 
ALTER TABLE `tb_petugas`
  ADD CONSTRAINT `tb_petugas_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `com_user` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE;
